Getting Started with Reports for WPF > Generating Reports (C1Report vs. C1PrintDocument) |
The Reports for WPF assembly now provides two distinctly different methods for generating reports:
While many existing reports can be correctly generated using either method, there are some important differences between them including:
Data Binding
Import creates a data-bound C1PrintDocument which is then generated, and data is fetched at that time. The resulting document can be refreshed with data refreshing. When the C1Report component is used, the generated document already contains embedded data fetched during document generation, and the resulting document is not data-bound (but of course, the report can be rendered again, refreshing the data).
Document Structure
When a report is imported in the resulting C1PrintDocument structure, all fields are represented by RenderField, and all sections by RenderSection objects. If a report definition contains groups, each group is represented by a RenderArea object, with nested RenderSection objects for the group header and footer, and a RenderArea for the nested group.
When the C1Report component is used, each report section is rendered into a RenderArea object. The fields are rendered as follows:
Page Size
When a report with unset (or set to zeroes) Layout.CustomWidth and Layout.CustomHeight properties is imported on a system without a printer, the default page size depends on the locale, as always in C1PrintDocument (for example, for US and Canada, the page size will be Letter, for Russia A4, and so on).
When such report is loaded into the C1Report component, the page size is always set to Letter (8.5 x 11 inches), which is the behavior of C1.Win.C1Report.C1Report.
Default Printer
On a system with one or more printers installed, the default page size for an imported report is determined using the same logic as for a regular C1PrintDocument (in particular, the C1PrintDocument.MeasurementPrinterName property is used to determine which printer to use). The main reason for this behavior is to avoid long wait times on systems with default network printers. When the C1Report component is used, the default page size is determined by the system default printer.
Import Limitations
The import method has some inherent limitations which are not likely to ever be lifted. Those include: